@svizzle/utils/string-[string-boolean]

Methods

(static) makeEndsWith() → {function}

Source:
Since:
  • 0.5.0
See:

Return a function expecting a base string and checking if it ends with the provided search string.

Example
> endsWithExclamationMark = makeEndsWith('!')
> endsWithExclamationMark('Hi!')
true
> endsWithExclamationMark('Who?')
false
Parameters:
Type Description
string

The search string

Returns:
  • String -> Boolean
Type
function

(static) makeStartsWith() → {function}

Source:
Since:
  • 0.5.0
See:

Return a function expecting a base string and checking if it starts with the provided search string.

Example
> startsWithHash = makeStartsWith('#')
> startsWithHash('# this is a bash comment')
true
> startsWithHash('This is not')
false
Parameters:
Type Description
string

The search string

Returns:
  • String -> Boolean
Type
function

(static) makeStringEndsWith(base) → {function}

Source:
Since:
  • 0.5.0
See:

Return a function expecting a search string and checking if the provided base string ends with the search string.

Example
> stringEndsWith = makeStringEndsWith('Hi!')
> stringEndsWith('!')
true
> stringEndsWith('?')
false
Parameters:
Name Type Description
base string

String to check

Returns:
  • String -> Boolean
Type
function

(static) makeStringStartsWith(base) → {function}

Source:
Since:
  • 0.5.0
See:

Return a function expecting a search string and checking if the provided base string starts with the search string.

Example
> stringStartsWith = makeStringStartsWith('Hi!')
> stringStartsWith('H')
true
> stringStartsWith('h')
false
Parameters:
Name Type Description
base string

String to check

Returns:
  • String -> Boolean
Type
function